<meta HTTP-EQUIV="refresh" CONTENT="10000">
<script>
 function showTimer() {
  var time=new Date();
  var hour=time.getHours();
  var minute=time.getMinutes();
  var second=time.getSeconds();
  if(hour<10)   hour  ="0"+hour;
  if(minute<10) minute="0"+minute;
  if(second<10) second="0"+second;
  var st=hour+":"+minute+":"+second;
  document.getElementById("timer").innerHTML=st; 
 }
 function initTimer() {
  // O metodo nativo setInterval executa uma determinada funcao em um determinado tempo  
  setInterval(showTimer,1000);
 }
</script>
<div id='wm'>
    <div class='title_wm'>
        WM - EXPEDINDO
    </div>
    <div id='deposito'>
        <% @depositos.each do |d| %>    
        <div class='deposito_<%= d.nome.downcase_br %>'>
            <table cellpadding="1" cellspacing="0" >
                <th>DEPOSITO</th>
                <th>BOX</th>
                <th>Nº.DT</th>
                <th>TRANSP.</th>
                <th>UF</th>
                <th>PARES</th>
                <th>CXS</th>
                <th>TIPO</th>
                <th>VOLUME</th>
                <th>PESO</th>
                <th>STATUS</th>
                <th>HORA</th>
                <% @transportes.each do |wm| %>            
                <% if wm.deposito.nome == d.nome%>
                <tr class="<%= cycle("even", "odd") -%>">
                    <td><%= wm.deposito.nome%></td>
                    <td><%=wm.box%></td>
                    <td><%=wm.ndt%></td>
                    <td><%=wm.transportadora.nome%></td>
                    <td><%=wm.uf.sigla%></td>
                    <td><%=wm.pares%></td>
                    <td><%=wm.cxs%></td>
                    <td><%=wm.tipo.sigla%></td>
                    <td><%=wm.m%></td>
                    <td><%=wm.peso%></td>
                    <td><%=wm.status.sigla%></td>
                    <td><%=wm.created_at.hour.to_s + ":" + wm.created_at.min.to_s + ":" + wm.created_at.sec.to_s%></td>
                </tr>
                <%end%>
                <%end%>
            </table>
            <!-- <div id='totais'>
                <table>
                    <tr>
                        <td align="left"  colspan="6">TOTAL &nbsp;&nbsp;<%= d.nome %></td>
                        <td align="right" colspan="6"><span><%= d.soma_s_d(1,d.id).contabil %></span></td>
                    </tr>
                </table>
            </div> 
            -->
        </div> 
        <%end%>
    </div>
    
    
    <div class='clock'>
        <span id="timer">Relógio</span>
    </div> 
    <!--
    <div id='total_geral'>
        <table>
            <tr>
                <td align="left"  colspan="6">
                    <div class='total_label'>
                        <h3>TOTAL SEPARAÇÃO</h3>
                    </div>
                </td>
                <td align="right" colspan="6">
                    <div class='total_valor'>
                        <% @x = Deposito.find(:first)%>
                        <h2><%= @x.soma_s(1).contabil %></h2>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    -->
</div>
